<template>
  <div>
    <van-datetime-picker
      v-model="currentDate"
      type="date"
      title="选择年月日"
      :min-date="minDate"
      :max-date="maxDate"
      @confirm="onConfirm"
      @cancel="$emit('close')"
    />
  </div>
</template>

<script>
import dayjs from 'dayjs';
export default {
  name: "UpdataBirthday",
  created() {},
  data() {
    return {
      minDate: new Date(1900, 0, 1),
      maxDate: new Date(),
      currentDate: new Date(this.birthday)
    };
  },
  props: {
    birthday:{
      require:true
    }
  },
  methods: {
    onConfirm(){
      const date = dayjs(this.currentDate).format('YYYY-MM-DD')
      this.$emit('updata-birthday',date)
      this.$emit('close')
    }
  },
};
</script>

<style lang="less" scoped></style>
